#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>


#define TIMES 10000000

int main(int argc, char *argv[]) {
  int i;

  FILE *fpwrite;

  char chaine[sizeof(argv[2])];

  if (argc != 3) {
    printf("USAGE = nfs fichier chaine\n");
    exit(1);
  }
  
  fpwrite = fopen(argv[1],"a");
  if (fpwrite == NULL) {
    printf("Error openning writing file : %s\n",argv[1]);
    abort();
  }
  for (i=0; i <= TIMES; i++) {
    if (fwrite(chaine,sizeof(chaine),1,fpwrite) != 1) {
      perror("Erreur lors de l'écriture");
      abort();
    }
  }

  fclose(fpwrite);
  return EXIT_SUCCESS;
}
